﻿/*
* 作 者: 槐尧
* 公 司: 墨宇天城
* 创建时间: 2016/3/17 23:22:26
* 说明:  
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

/// <summary>
/// 文件管理类
/// </summary>
public class FruitLogic
{
    List<int> listint = new List<int>();
    public static int GetTagPos()
    {
        //test
        FruitLogic fl= new FruitLogic();
        return fl.Getrandom();
    }
    public int Getrandom()
    {
        listint.Clear();
        listint = FruitDataManager.Intstance.GetrecordFruitprecent();
        int random = Random.Range(0, FruitDataManager.Intstance.GetCalculateNum());
        Debug.Log("ret   " + random );
        int index = GetValue(random);
        return index;
    }


    public int GetValue(int num)
    {
        int index = 0;
        for (int i = 0; i < listint.Count; i++)
        {
            if (num < listint[i])
            {
                index = i;
                break;
            }
        }
        return index;
    }
    
}